// pages/order_detail/index.js
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        position:'static',
        bottom:'auto',
        marginBottom:'0',
        orderItem:{
            status:'0'
        }
    },
    modifyPrice(){
        wx.navigateTo({
            url: '/pages/order_price_change/index',
        })
    },
    closeOrder(){
        wx.navigateTo({
            url: '/pages/order_close/index',
        })
    },
    modifyAddress(){
        wx.navigateTo({
            url: '/pages/order_addresseeinfo_modify/index'
        })
    },
    delivery(){
        wx.navigateTo({
            url: '/pages/order_delivery/index'
        })
        
    },
    acceptOrder(){
        wx.showModal({
            // title: '确认接单？',
            content: '确认接单？',
            confirmText: "确定",
            cancelText: "取消",
            confirmColor:'#2395FF',
            success: function (res) {
                console.log(res);
                if (res.confirm) {
                    console.log('用户点击主操作')
                    
                } else {
                    console.log('用户点击辅助操作')
                }
            }
        });
    },
    refund(){
        wx.showModal({
            // title: '',
            content: '确认同意退款？',
            confirmText: "确认",
            cancelText: "取消",
            confirmColor: '#333333',
            success: function (res) {
                console.log(res);
                if (res.confirm) {
                    console.log('用户点击主操作')

                } else {
                    console.log('用户点击辅助操作')
                }
            }
        });
    },
    deliverInvoice(){
        wx.navigateTo({
            url: '/pages/order_invoice_delivery/index'
        })
    },
    underlineInvoice() {
        wx.showModal({
            // title: '',
            content: '确认线下取票？',
            confirmText: "确认",
            cancelText: "取消",
            confirmColor: '#2395FF',
            success: function (res) {
                console.log(res);
                if (res.confirm) {
                    console.log('用户点击主操作')

                } else {
                    console.log('用户点击辅助操作')
                }
            }
        });
    },
    

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {

        
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {
        let that = this;
        const query = wx.createSelectorQuery()
        query.select('.order-modify-item').boundingClientRect(function (res) {
            if (res.bottom > app.globalData.windowHeight){
                that.setData({
                    position:'fixed',
                    bottom:0,
                    marginBottom:'100rpx'
                });
            }

        })
        query.selectViewport().scrollOffset(function (res) {
            res.scrollTop // 显示区域的竖直滚动位置
        })
        query.exec()
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})